﻿using System.ComponentModel.DataAnnotations;
using Lbb.Localization;

namespace Lbb.DataAnnotations
{
    /// <summary>
    /// 指定数据字段是邮箱地址.
    /// </summary>
    /// <author>Chiron</author>
    public class NEMailAttribute : RegularExpressionAttribute
    {
        /// <summary>
        /// 指定数据字段是邮箱地址.
        /// </summary>
        public NEMailAttribute()
            : base(@"^[a-zA-Z0-9_\-\.]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$")
        {
            ErrorMessageResourceType = typeof(ErrorRes);
            ErrorMessageResourceName = "RegularEMail";
        }
    }
}
